package LuoGu.暴力.珠心算测验;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int [] temp = new int [10000001];
        int [] temp1 = new int[n];
        for(int i=0;i<n;i++){
            temp1[i] = s.nextInt();
            temp[temp1[i]]++;
        }
        int ans = 0;
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                int a = temp1[i];
                int b = temp1[j];
                if(temp[a+b]==1){
                    ans++;
                    temp[a+b]--;
                }
            }
        }
        System.out.print(ans);
    }
}
